// CurrRecordThread.h: interface for the CurrRecordThread class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CURRRECORDTHREAD_H__530E8DCC_52AD_412F_9049_4EDD63F41F9A__INCLUDED_)
#define AFX_CURRRECORDTHREAD_H__530E8DCC_52AD_412F_9049_4EDD63F41F9A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "CommonLib\Thread.h"
#include "CommonLib\RecordManager.h"

#include "Ado.h"
//#include "DigitalCurrentData.h"

#include "MonitoringUnitLib\BaseCoalMineUnit.h"
#include "MonitoringUnitLib\AnalogUnit.h"
#include "MonitoringUnitLib\DigitalUnit.h"
#include "..\..\\CommonLibs\CommonLib\Log.h"
//class CCurrRecord;

class CurrRecordThread : public Thread
{
public:
	void DeleteAllCurrRecords();
	void DeleteAllCurrRecords(int nId);
	bool UpdateCurrData(CurrRecord er );
	bool UpdateCurrDataEx(CurrRecord er );
	bool SetRecordsUnused(long nCoalMineId);
	bool DeleteUnusedData(CurrRecord er);
	CurrRecordThread();
	virtual ~CurrRecordThread();

	virtual bool InitInstance();
	virtual bool ExitInstance();
	virtual int Run();

	void Cancel() {m_bCancel = true;}

protected:
	bool m_bCancel;
	CString	m_RecordNum;
	long	m_CoalMineId;
	CString	m_CoalMineName;
	CString	m_MonUnitId;
	CString	m_MonUnitName;
	CString	m_MonUnitType;
	CString	m_MonUnitUnit;
	BYTE	m_MonUnitState;
	CString	m_MonUnitStateDes;
	CTime	m_StateChangeTime;
	float	m_MonUnitData;
	CTime	m_DataChangeTime;
	float	m_AlarmLowerLimit;
	float	m_AlarmUpperLimit;
	float	m_ComeBackLimit;
	BYTE	m_Modify;

	//CDatabase * pDatabase;
	CAdoConnection * m_adopConnection;
	CAdoConnection * m_adopConnection1;
	CAdoConnection * m_adopConnection2;
	CAdoRecordSet  m_adoRecordSet;
	CAdoRecordSet  m_adoUpdateRecordSet;//06-3-7

	CMutex m_mutexRecords;
	long m_nCurrId;
	CLog *pLog;
	//AnalogCurrData        * m_prsAnalogCurrRecord;
	//DigitalCurrentData    * m_prsDigitalCurrRecord;
};

#endif // !defined(AFX_CURRRECORDTHREAD_H__530E8DCC_52AD_412F_9049_4EDD63F41F9A__INCLUDED_)
